package cn.iocoder.yudao.module.reading.enums.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 语言类型枚举
 *
 * @author 芋道源码
 */
@AllArgsConstructor
@Getter
public enum LanguageEnum {

    CHINESE("chinese", "中文"),
    ENGLISH("english", "英文"),
    BILINGUAL("bilingual", "双语");

    /**
     * 语言代码
     */
    private final String code;
    /**
     * 语言名称
     */
    private final String name;

    public static LanguageEnum fromCode(String code) {
        for (LanguageEnum language : values()) {
            if (language.getCode().equals(code)) {
                return language;
            }
        }
        return null;
    }

}
